export default {
    data() {
        return {
            tjObj: {
                money:'支付金额（元）',
                order:'支付订单数',
                store:'支付商户数',
            },
            tjData:{},
             openId: ''
        }
    },
    onLoad() {
        this.getOpenId();
    },
    methods: {
        toOrder:function(){
            uni.switchTab({ url: '/pages/order/index' })
        },
        getOpenId: function () {
            let openId = uni.getStorageSync("openid") || ''
            console.log(openId)
            this.openId = openId
            // if(openId){
                this.tiktokCenter(openId)
            // }
        },
        tiktokLogin: function () {

            tt.login({
                force: true,
                success: (res) => {
                    console.log(`login 调用成功${res.code} ${res.anonymousCode}`);
                    this.$post('login/tiktokLogin',
                        {
                            code: res.code
                        }
                    ).then(res => {
                        if (res.code == 1) {
                            uni.setStorageSync("openid", res.data.openid);
                            this.getOpenId();
                        } else {
                            this.uniToast(res.msg)
                        }
                    }).finally(() => {
                    })
                },
                fail: (res) => {
                    console.log(`login 调用失败`);
                },
            });
        },
        tiktokCenter:function(openid){
            this.$post('order.orderCode/tiktokCenter',
                {openid:openid }
                    ).then(res => {
                    if (res.code == 1) {
                        this.tjData = res.data ||{}
                }else{
                  this.uniToast(res.msg)
                }
                 }).finally(() => {
                 })
        }
    }
}